package cn.nextProject.entity;

import lombok.Data;

import java.sql.Blob;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Data
public class User {

    private String username;

    private String realname;

    private byte[] userKey;

    private String userPassword;

    private String idCard;

    private String phone;

    private String headPicture;

    private Integer state;

    private List<RoleGroup> roleGroupList; //用户角色组

    private Date createTime;

    private Date modifyTime;

    private Long id;
    @Override
    public boolean equals(Object o){

        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(username, user.username) &&
                Objects.equals(realname, user.realname) &&
                Objects.equals(idCard, user.idCard) &&
                Objects.equals(phone, user.phone) &&
                Objects.equals(state, user.state);

    }

    @Override
    public int hashCode() {
        return Objects.hash(username, realname, idCard, phone, state);
    }

    /*
    CREATE TABLE `user` (
  `username` varchar(255) NOT NULL COMMENT '用户名',
  `realname` varchar(255) DEFAULT NULL COMMENT '姓名',
  `userKey` blob NOT NULL COMMENT '密钥',
  `userPassword` varchar(255) NOT NULL COMMENT '密码',
  `idCard` varchar(255) NOT NULL COMMENT '身份证号',
  `phone` varchar(11) DEFAULT NULL COMMENT '手机号',
  `headPicture` varchar(255) DEFAULT NULL COMMENT '头像',
  `state` int NOT NULL DEFAULT '1' COMMENT '状态（1：正常；2：禁用）',
  `createTime` datetime NOT NULL COMMENT '注册时间',
  `modifyTime` datetime DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
     */


}
